<template>
	<view class="bs-share-box">

		<view class="share-btn" @click="open">
			<u-icon name="zhuanfa" size="42" color='#0050A5'></u-icon>
			<view class="share-text">
				分享
			</view>
		</view>
		<u-popup v-model="show" mode='bottom'>
			<view class="pop-box">
				<view class="title">
					分享至
				</view>
				<view class="pop-icons">
					<!-- @click="handShare('weixin')" -->
					<view class="item">
						<button hover-class='none' open-type="share" class="share-icon" type="default"></button>
						<text class='icon-text'>微信</text>
					</view>
					<view class="item" @click="handShare('weibo')">
						<button hover-class='none' open-type="share" class="share-icon share-icon-wb" type="default"></button>
						<text class='icon-text'>微博</text>
					</view>
					<view class="item" @click="handShare('weixin')">
						<image class="icon" src="http://111.229.30.99:9000/image/ewm.png" mode=""></image>
						<text class='icon-text'>保存二维码</text>
					</view>
				</view>
				<bs-gap top='0' bottom='46'></bs-gap>
				<view class="clos" @click="show=false">
					取消
				</view>
			</view>

		</u-popup>
		<u<!-- -modal v-model="modalShow">
			<canvas canvas-id="qrcode" style="width: 200px;height: 200px;" />
			</u-modal> -->
	</view>
</template>

<script>
	import {
		share
	} from '@/utils/tools.js'
	import uQRCode from '@/utils/uqrcode.js'
	export default {
		data() {
			return {
				show: false,
				modalShow: false
			};
		},
		
		methods: {
			open() {
				this.show = true
			},
			handShare(type) {
				// this.$u.mpShare.title = '天苍苍野茫茫，风吹草低见牛羊';
				// uni.getProvider({
				// 	service: 'share',
				// 	success: function(res) {
				// 		console.log(res)
				// 	}
				// });
				share().then(res => {
					console.log(res, '分享成功了吗??')
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.bs-share-box {

		.pop-box {
			text-align: center;
			padding: 40rpx 0;

			button::after {
				border: none;
			}

			.share-icon {
				background: url(http://111.229.30.99:9000/image/wx.png) no-repeat;
				background-size: 100%;
				border: 0;
				border-radius: 50%;
				width: 120rpx;
				height: 120rpx;
			}

			.share-icon-wb {
				background: url(http://111.229.30.99:9000/image/wb.png) no-repeat;
				background-size: 100%;
			}

			.clos {
				color: #000;
				font-size: 32rpx;
			}

			.pop-icons {
				padding: 0 80rpx;
				@include my-flex($jc: $bs-sb, $ai:center);
				margin-bottom: 60rpx;

				.item {
					@include my-flex($fd: column, $jc:center, $ai:center);

					.icon {
						width: 120rpx;
						height: 120rpx;
					}

					.icon-text {
						margin-top: 14rpx;
						color: #000;
						font-size: 28rpx;
					}
				}
			}

			.title {
				font-size: $bs-font-size-32;
				color: #666;
				margin-bottom: 80rpx;
			}
		}

		.share-btn {
			width: 100rpx;
			height: 100rpx;
			position: fixed;
			right: 30rpx;
			bottom: 60rpx;
			background: #FFFFFF;
			box-shadow: 0 0 24px 0 rgba(0, 0, 0, 0.12);
			z-index: 2;
			border-radius: 50%;
			@include my-flex($fd: column, $ai:center, $jc:center);
			// flex-direction: column;

			.share-text {
				color: $bs-text-color-333;
				font-size: 20rpx;

			}
		}
	}
</style>
